<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div class="box">

    </div>
</body>

</html>
<script>

    function ajax(method, url, Cb) {
        //1.创建xhr请求对象
        var xhr = new XMLHttpRequest()
        //2.配置请求对象
        xhr.open(method, url)
        //3.设置回调函数
        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4) {
                Cb(JSON.parse(xhr.responseText))
            }
        }
        xhr.send()
    }
    ajax('get', "./zuoye.json", function (date) {
        var str = date.list.map((item) => {
            return `<p>${item.li}</p>`
        }).join('')
        // console.log(data.list);
        document.querySelector('.box').innerHTML = str
    })

</script>